import { http } from '@/utils';

// 获取用户信息
export const getUserInfo = () => {
  return async (dispatch, getState) => {
    // 发起获取用户信息的请求
    // const res = await http.get('/user/profile', {
    //   headers: {
    //     Authorization: `Bearer ${getState().login}`,
    //   },
    // });
    const res = await http.get('/user/profile');

    // console.log('用户信息', res);

    // 稍后存到 reducer 中
    dispatch({ type: 'user/getUserInfo', payload: res.data.data });
  };
};
